/* gtrans - Translation helped by Google
 * Copyright (C) 2011 Nagy Attila
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef SETTINGS_H_INCLUDED
#define SETTINGS_H_INCLUDED

#include "defs.h"
#include <gtkmm.h>
#include <giomm/settings.h>

class Settings : public Gtk::Dialog
{
public:
    Settings (languages_map& langs/*, const Glib::RefPtr<Gio::Settings>& settings*/);
    virtual ~Settings ();

protected:
    void on_source_lang_changed ();
    void on_target_lang_changed ();
    void on_closed ();
    bool on_source_lang_item (Gtk::TreeIter node);
    bool on_target_lang_item (Gtk::TreeIter node);

    languages_map languages;
    struct classcomp
    {
        bool operator() (const std::string& string1, const std::string& string2) const
        {
            std::locale currentLocale ("");
            return currentLocale (string1, string2);
        }
    };

    class ModelColumns : public Gtk::TreeModel::ColumnRecord
    {
    public:
        ModelColumns()
        {
            add(m_col_id);
            add(m_col_name);
        }

        Gtk::TreeModelColumn<Glib::ustring> m_col_id;
        Gtk::TreeModelColumn<Glib::ustring> m_col_name;
    };

    Gtk::Notebook m_notebook;
    Gtk::VBox m_vbox_general;
    Gtk::VBox m_vbox_advanced;

    ModelColumns m_source_lang_columns;
    ModelColumns m_target_lang_columns;
    Glib::RefPtr<Gtk::ListStore> m_refSourceLangModel;
    Glib::RefPtr<Gtk::ListStore> m_refTargetLangModel;

    Glib::RefPtr<Gio::Settings> m_refSettings;
    Gtk::CheckButton m_enabled_checkbox;
    Gtk::HBox m_lang_box;
    Gtk::VBox m_source_box;
    Gtk::VBox m_target_box;
    Gtk::Label m_source_label;
    Gtk::Label m_target_label;
    Gtk::ComboBox m_source_lang_combobox;
    Gtk::ComboBox m_target_lang_combobox;
    Gtk::CheckButton m_listen_source_checkbox;
    Gtk::CheckButton m_listen_target_checkbox;

    Gtk::Label m_api_key_label;
    Gtk::Entry m_api_key_entry;
};

#endif // SETTINGS_H_INCLUDED

